require "extern"

MediatorManager = {}

local allMdt = {}

function MediatorManager:getMdtByName(mname)
	return allMdt[mname]
end

function MediatorManager:register(mname, mdt)
	if mname~= nil and mdt ~= nil and allMdt[mname]==nil and mdt.mdtName==nil then
		allMdt[mname] = mdt
		mdt.mdtName = mname
	end
end

function MediatorManager:remove(mdt)
	if mdt == nil or mdt.mdtName == nil then
		return
	end
	allMdt[mdt.mdtName] = nil
	mdt.mdtName = nil
end

function MediatorManager:removeByName(mname)
	local mdt = allMdt[mname]
	if mdt == nil then
		return
	end
	allMdt[mname] = nil
	mdt.mdtName = nil
end

